package com.lm.hutool.example;

import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HutoolExcelExample {
    public static void main(String[] args) {
        // 写入 Excel
        List<Map<String, Object>> rows = new ArrayList<>();
        Map<String, Object> row = new HashMap<>();
        row.put("姓名", "张三");
        row.put("年龄", 25);
        rows.add(row);

        ExcelWriter writer = ExcelUtil.getWriter("test.xlsx");
        writer.write(rows, true);
        writer.close();
        System.out.println("Excel 写入完成！");
    }
}
